﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HaSdkWrapper
{
    public static class Converter
    {
        public static HaColor ConvertColor(int c)
        {
            switch (c)
            {
                case 0:
                    return HaColor.Blue;
                case 1:
                    return HaColor.Black;
                case 2:
                    return HaColor.Yellow;
                case 3:
                    return HaColor.White;
                case 4:
                    return HaColor.Green;
                default:
                    return HaColor.Unknown;
            }

        }

        public static DateTime ConvertToDateTime(int seconds, int useconds)
        {
            var milliseconds = useconds * 0.001;
            var dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
            dtDateTime = dtDateTime.AddSeconds(seconds).AddMilliseconds(milliseconds).ToLocalTime();
            return dtDateTime;
        }

    }
}
